import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public class StudentSortID {
    public static void main(String[] args) {
        List<Student> list = new LinkedList<Student>();
        list.add(new Student("20175322", "周弋鸿", 'M',
                20, 89, 92, 76));
        list.add(new Student("20175323", "鞠欣余", 'F',
                19, 95, 73, 99));
        list.add(new Student("20175325", "石淦明", 'F',
                20, 79, 64, 79));
        list.add(new Student("20175324", "王陈峤宇", 'M',
                19, 90, 75, 80.5));
        list.add(new Student("20175326", "李一潇", 'M',
                20, 83, 85, 90));
        Iterator<Student> iterator = list.iterator();
        System.out.println("排序前：");
        while (iterator.hasNext()) {
            Student stu = iterator.next();
            System.out.println(stu.toString());
        }
        Collections.sort(list, new ComparatorByID());
        System.out.println("按照学号排序后：");
        iterator = list.iterator();
        while (iterator.hasNext()) {
            Student stu = iterator.next();
            System.out.println(stu.toString());
        }
    }
}